// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Video Stitcher API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_video_stitcher_v1::client::VideoStitcherService;
/// let client = VideoStitcherService::builder().build().await?;
/// // use `client` to make requests to the Video Stitcher API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Video-On-Demand content stitching API allows you to insert ads
/// into (VoD) video on demand files. You will be able to render custom
/// scrubber bars with highlighted ads, enforce ad policies, allow
/// seamless playback and tracking on native players and monetize
/// content with any standard VMAP compliant ad server.
///
/// # Configuration
///
/// To configure `VideoStitcherService` use the `with_*` methods in the type returned
/// by [builder()][VideoStitcherService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://videostitcher.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::video_stitcher_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::video_stitcher_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `VideoStitcherService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `VideoStitcherService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct VideoStitcherService {
    inner: std::sync::Arc<dyn super::stub::dynamic::VideoStitcherService>,
}

impl VideoStitcherService {
    /// Returns a builder for [VideoStitcherService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_video_stitcher_v1::client::VideoStitcherService;
    /// let client = VideoStitcherService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::video_stitcher_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::video_stitcher_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::VideoStitcherService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VideoStitcherService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VideoStitcherService> {
        super::transport::VideoStitcherService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::VideoStitcherService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::VideoStitcherService::new)
    }

    /// Creates a new CDN key.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_cdn_key(&self) -> super::builder::video_stitcher_service::CreateCdnKey {
        super::builder::video_stitcher_service::CreateCdnKey::new(self.inner.clone())
    }

    /// Lists all CDN keys in the specified project and location.
    pub fn list_cdn_keys(&self) -> super::builder::video_stitcher_service::ListCdnKeys {
        super::builder::video_stitcher_service::ListCdnKeys::new(self.inner.clone())
    }

    /// Returns the specified CDN key.
    pub fn get_cdn_key(&self) -> super::builder::video_stitcher_service::GetCdnKey {
        super::builder::video_stitcher_service::GetCdnKey::new(self.inner.clone())
    }

    /// Deletes the specified CDN key.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_cdn_key(&self) -> super::builder::video_stitcher_service::DeleteCdnKey {
        super::builder::video_stitcher_service::DeleteCdnKey::new(self.inner.clone())
    }

    /// Updates the specified CDN key. Only update fields specified
    /// in the call method body.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_cdn_key(&self) -> super::builder::video_stitcher_service::UpdateCdnKey {
        super::builder::video_stitcher_service::UpdateCdnKey::new(self.inner.clone())
    }

    /// Creates a client side playback VOD session and returns the full
    /// tracking and playback metadata of the session.
    pub fn create_vod_session(&self) -> super::builder::video_stitcher_service::CreateVodSession {
        super::builder::video_stitcher_service::CreateVodSession::new(self.inner.clone())
    }

    /// Returns the full tracking, playback metadata, and relevant ad-ops
    /// logs for the specified VOD session.
    pub fn get_vod_session(&self) -> super::builder::video_stitcher_service::GetVodSession {
        super::builder::video_stitcher_service::GetVodSession::new(self.inner.clone())
    }

    /// Returns a list of detailed stitching information of the specified VOD
    /// session.
    pub fn list_vod_stitch_details(
        &self,
    ) -> super::builder::video_stitcher_service::ListVodStitchDetails {
        super::builder::video_stitcher_service::ListVodStitchDetails::new(self.inner.clone())
    }

    /// Returns the specified stitching information for the specified VOD session.
    pub fn get_vod_stitch_detail(
        &self,
    ) -> super::builder::video_stitcher_service::GetVodStitchDetail {
        super::builder::video_stitcher_service::GetVodStitchDetail::new(self.inner.clone())
    }

    /// Return the list of ad tag details for the specified VOD session.
    pub fn list_vod_ad_tag_details(
        &self,
    ) -> super::builder::video_stitcher_service::ListVodAdTagDetails {
        super::builder::video_stitcher_service::ListVodAdTagDetails::new(self.inner.clone())
    }

    /// Returns the specified ad tag detail for the specified VOD session.
    pub fn get_vod_ad_tag_detail(
        &self,
    ) -> super::builder::video_stitcher_service::GetVodAdTagDetail {
        super::builder::video_stitcher_service::GetVodAdTagDetail::new(self.inner.clone())
    }

    /// Return the list of ad tag details for the specified live session.
    pub fn list_live_ad_tag_details(
        &self,
    ) -> super::builder::video_stitcher_service::ListLiveAdTagDetails {
        super::builder::video_stitcher_service::ListLiveAdTagDetails::new(self.inner.clone())
    }

    /// Returns the specified ad tag detail for the specified live session.
    pub fn get_live_ad_tag_detail(
        &self,
    ) -> super::builder::video_stitcher_service::GetLiveAdTagDetail {
        super::builder::video_stitcher_service::GetLiveAdTagDetail::new(self.inner.clone())
    }

    /// Creates a slate.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_slate(&self) -> super::builder::video_stitcher_service::CreateSlate {
        super::builder::video_stitcher_service::CreateSlate::new(self.inner.clone())
    }

    /// Lists all slates in the specified project and location.
    pub fn list_slates(&self) -> super::builder::video_stitcher_service::ListSlates {
        super::builder::video_stitcher_service::ListSlates::new(self.inner.clone())
    }

    /// Returns the specified slate.
    pub fn get_slate(&self) -> super::builder::video_stitcher_service::GetSlate {
        super::builder::video_stitcher_service::GetSlate::new(self.inner.clone())
    }

    /// Updates the specified slate.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_slate(&self) -> super::builder::video_stitcher_service::UpdateSlate {
        super::builder::video_stitcher_service::UpdateSlate::new(self.inner.clone())
    }

    /// Deletes the specified slate.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_slate(&self) -> super::builder::video_stitcher_service::DeleteSlate {
        super::builder::video_stitcher_service::DeleteSlate::new(self.inner.clone())
    }

    /// Creates a new live session.
    pub fn create_live_session(&self) -> super::builder::video_stitcher_service::CreateLiveSession {
        super::builder::video_stitcher_service::CreateLiveSession::new(self.inner.clone())
    }

    /// Returns the details for the specified live session.
    pub fn get_live_session(&self) -> super::builder::video_stitcher_service::GetLiveSession {
        super::builder::video_stitcher_service::GetLiveSession::new(self.inner.clone())
    }

    /// Registers the live config with the provided unique ID in
    /// the specified region.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_live_config(&self) -> super::builder::video_stitcher_service::CreateLiveConfig {
        super::builder::video_stitcher_service::CreateLiveConfig::new(self.inner.clone())
    }

    /// Lists all live configs managed by the Video Stitcher that
    /// belong to the specified project and region.
    pub fn list_live_configs(&self) -> super::builder::video_stitcher_service::ListLiveConfigs {
        super::builder::video_stitcher_service::ListLiveConfigs::new(self.inner.clone())
    }

    /// Returns the specified live config managed by the Video
    /// Stitcher service.
    pub fn get_live_config(&self) -> super::builder::video_stitcher_service::GetLiveConfig {
        super::builder::video_stitcher_service::GetLiveConfig::new(self.inner.clone())
    }

    /// Deletes the specified live config.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_live_config(&self) -> super::builder::video_stitcher_service::DeleteLiveConfig {
        super::builder::video_stitcher_service::DeleteLiveConfig::new(self.inner.clone())
    }

    /// Updates the specified LiveConfig. Only update fields specified
    /// in the call method body.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_live_config(&self) -> super::builder::video_stitcher_service::UpdateLiveConfig {
        super::builder::video_stitcher_service::UpdateLiveConfig::new(self.inner.clone())
    }

    /// Registers the VOD config with the provided unique ID in
    /// the specified region.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_vod_config(&self) -> super::builder::video_stitcher_service::CreateVodConfig {
        super::builder::video_stitcher_service::CreateVodConfig::new(self.inner.clone())
    }

    /// Lists all VOD configs managed by the Video Stitcher API that
    /// belong to the specified project and region.
    pub fn list_vod_configs(&self) -> super::builder::video_stitcher_service::ListVodConfigs {
        super::builder::video_stitcher_service::ListVodConfigs::new(self.inner.clone())
    }

    /// Returns the specified VOD config managed by the Video
    /// Stitcher API service.
    pub fn get_vod_config(&self) -> super::builder::video_stitcher_service::GetVodConfig {
        super::builder::video_stitcher_service::GetVodConfig::new(self.inner.clone())
    }

    /// Deletes the specified VOD config.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_vod_config(&self) -> super::builder::video_stitcher_service::DeleteVodConfig {
        super::builder::video_stitcher_service::DeleteVodConfig::new(self.inner.clone())
    }

    /// Updates the specified VOD config. Only update fields specified
    /// in the call method body.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_vod_config(&self) -> super::builder::video_stitcher_service::UpdateVodConfig {
        super::builder::video_stitcher_service::UpdateVodConfig::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::video_stitcher_service::ListOperations {
        super::builder::video_stitcher_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::video_stitcher_service::GetOperation {
        super::builder::video_stitcher_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::video_stitcher_service::DeleteOperation {
        super::builder::video_stitcher_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::video_stitcher_service::CancelOperation {
        super::builder::video_stitcher_service::CancelOperation::new(self.inner.clone())
    }
}
